#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int n;
int a[N];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		LL ans = 0;
		if (n == 1) {
			cout << 0 << endl;
			continue;
		}
		else if (n == 2) {
			cout << 1 << endl;
			continue;
		}
		else if (n == 3) {
			cout << 3 << endl;
			continue;
		}
		a[1] = n - 1;
		a[2] = 1;
		a[3] = n;
		int idx1 = 2, idx2 = n - 2;
		for (int i = 4; i <= n; i++) {
			if (i & 1)a[i] = idx2--; 
			else a[i] = idx1++;
		}
		for (int i = 1; i <= n - 1; i++) {
			ans += abs(a[i + 1] - a[i]);
		}
		/*for (int i = 1; i <= n; i++) {
			cout << a[i] << " ";
		}
		cout << endl;*/
		LL ans1 = ans - abs(a[n] - a[n - 1]) + (abs(a[1] - a[n]));
		//cout << ans << endl;
		cout << max(ans1, ans) << endl;
		for (int i = 1; i <= n; i++)a[i] = 0;
	}
	return 0;
}